<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>猜数字游戏</title>
		<script type="text/javascript">
			
			function getRandom(min,max) {
				return Math.floor(Math.random() * ( max - min + 1)) + min;
			}
			var result = getRandom(1,10);
			while(true) {
				var num = prompt('请输入1到10之间的数字');
				if(result > num) {
					alert('你猜小了');
				}else if(result < num) {
					alert('你猜大了');
				}else {
					alert('你猜对了!');
					break;
				}
			}
		</script>
	</head>
	<body>
	</body>
</html>
